﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SGA.Mailing
{
    public partial class RegisterMailing : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void LVMailing_ItemInserting(object sender, ListViewInsertEventArgs e)
        {
            string year = ((TextBox)((ListView)sender).InsertItem.FindControl("TextBoxYear")).Text;
            string month = ((TextBox)((ListView)sender).InsertItem.FindControl("TextBoxMonth")).Text;
            string receipient = ((DropDownList)((ListView)sender).InsertItem.FindControl("DDLRecipientTypes")).SelectedValue;
            string product = ((DropDownList)((ListView)sender).InsertItem.FindControl("DDLProducts")).SelectedValue;


            e.Values["Designation"] = year + month + receipient + product;
            e.Values["IdThankLettersRepository"] = 1;
            e.Values["IdReceipientTypes"] = 1;
            e.Values["IdProducts"] = 1;
            //string str = (string)e.Values["DispatchDate"];
            //string str = (string)e.Values["UnitCost"];
            //string str = (string)e.Values["Designation"];
            //string str = (string)e.Values["Description"];
        }

        protected void SaveButton_Click(object sender, EventArgs e)
        {
            LVMailing.InsertNewItem(true);
        }
    }
}